package com.sj.mapper;

import com.sj.entity.Footprint;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * <p>
 * 足迹表 Mapper 接口
 * </p>
 *
 * @author 孙峻
 * @since 2022-03-09
 */
@Mapper
@Repository
public interface FootprintMapper extends BaseMapper<Footprint> {

    /**
     * 获取用户足迹数量
     * @param id
     * @return
     */
    @Select("select count(*) as total from footprint t1 left join article t2 on t1.article_id = t2.id where t1.del = 0 and t2.del = 0 and t1.user_id = #{id}")
    Long getUserFootprintNum(Integer id);
}
